<template>
  <div v-if="bool">
    <h1>{{ msg }}</h1>
    <button @click="msg = 'Hello'">点我改变数据</button>
    <button @click="bool = !bool">销毁</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      msg: '你好世界',
      bool: true
    };
  },
  beforeCreate() {
    console.log('f1', this.msg)
  },
  created() {
    console.log('f2', this.msg)
  },
  beforeMount() {
    console.log('f3', document.querySelector('h1'))
  },
  mounted() {
    console.log('f4', document.querySelector('h1'))
  },
  beforeUpdate() {
    console.log('f5', document.querySelector('h1').innerHTML)
  },
  updated() {
    console.log('f6', document.querySelector('h1').innerHTML)
  },
  beforeDestroy() {
    console.log('f7')
  },
  destroyed() {
    console.log('f8')
  }
};
</script>

<style lang="scss" scoped>

</style>